home *** CD-ROM | disk | FTP | other *** search
- Path: library.erc.clarkson.edu!rpi!not-for-mail
- From: Rick Richert <richert@butch.lmsc.lockheed.com>
- Newsgroups: comp.lang.c++,comp.lang.c++.moderated
- Subject: Argc & Argv
- Date: 26 Feb 1996 21:55:59 -0000
- Organization: Org. 81-20
- Sender: cppmods@netlab.cs.rpi.edu
- Approved: Dietmar.Kuehl@uni-konstanz.de
- Message-ID: <4gta9f$df5@netlab.cs.rpi.edu>
- NNTP-Posting-Host: netlab.cs.rpi.edu
- X-Original-Date: 26 Feb 1996 21:49:43 GMT
-
- >> I tried posting this last week and am not sure if it was posted or
- >> not. Soooo, I'm trying again.
-
- I have some global objects defined outside the main routine and I would
- like to pass the argc and argv values to their constructors. For example,
-
-
- SomeClass obj( argc, argv);
-
- int main( int argc, char **argv) {
-
- blah, blah, blah
-
- }
-
- Unfortunately, the compiler tells me that argc and argv are not defined
- or else not available for obj.
-
- Currently, I get around this problem by creating the global obj and then
- inside of main, I initialize obj via a method that takes argc and argv.
-
- I would prefer to pass the arg vars to the constructor. Does anyone know
- how I can pass the arg vars without being inside of main?
-
-
- [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
- [ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
- [ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
- [ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
-